{% extends "administrative/base.html" %}

{% block page_link %}
    <script src="../../static/administrative/js/document.js"></script>
    <link rel="stylesheet" href="../../static/administrative/css/style.css">
{% endblock %}


{% block style %}
    <style>
        .add_class{
            background: #1E90FF;
        }
        .file {
            position: relative;
            display: inline-block;
            border-radius: 4px;
            padding: 4px 12px;
            overflow: hidden;
            color: #1E88C7;
            text-decoration: none;
            text-indent: 0;
            line-height: 20px;
        }
        .file input {
            position: absolute;
            font-size: 100px;
            right: 0;
            top: 0;
            opacity: 0;
        }
        .file:hover {
            background: #AADFFD;
            border-color: #78C3F3;
            color: #004974;
            text-decoration: none;
        }
        tr{
            height: 35px;
        }
        th{
            text-align: center;
        }
        table {
            table-layout: fixed;
        }
        td:first-child, th:first-child {
            position:sticky;
            left:0; /* 首行永远固定在左侧 */
            z-index:1;
        }
        thead tr th {
            position:sticky;
            top:0; /* 列首永远固定在头部  */
            background-color: #E8E8E8;
        }
        th:first-child{
            z-index:2;
        }
        .li-class{
            list-style: none;
            margin-top: 2%;
            color: #0b0b0b;
            cursor: pointer;
        }
        .preserve{
            height: 30px;width: 90%;background: #0070c1;color: #ffffff;border-radius: 3px
        }
    </style>
{% endblock %}



{% block right_content %}
    <div class="headline">
        <div style="width: 15%;height: 100%;line-height: 40px;float: left;padding-left: 1%;">
            <a href="document.html" style="color: #0b0b0b;">
                <i class="iconfont icon-gongwenfawen"></i>
                <span> 公文发起</span>
            </a>
        </div>

        <div style="width: 7%;text-align: center;height: 100%;line-height: 40px;float: right;">
            <button id="add_station" type="button" class="btn btn-default add-station preserve" onclick="submit_val()">提交</button>
        </div>
    </div>

    <div class="right-box" style="width: 100%;height: 91%;overflow: auto;padding-bottom: 1%;">
        <div style="width: 80%;margin-top: 1%;margin-left: 1%;display: inline-block;">
            <div style="width: 99%;background: white;">
                <table style="width: 100%;">
                    <tr>
                        <td style="text-align: center;height: 60px;line-height: 60px;width: 100%;"><h3 style="color: red;">发文单</h3></td>
                    </tr>
                </table>
                <div style="padding-left: 1%;padding-right: 1%;width: 100%;color: #0b0b0b;">
                    <table style="width: 100%;">
                        <tr style="margin-left: 1%;">
                            <td style="width: 8%;border: red solid 0.5px;text-align: right;height: 35px;line-height: 35px;">选择模版：</td>
                            <td style="width: 30%;border: red solid 0.5px;padding-left: 0.5%;">
                                <select name="" id="model_name" style="width: 98%;border: 0;" onchange="get_option()">
                                    {% for model_name in model_name_list %}
                                        <option value="{{ model_name }}">{{ model_name }}</option>
                                    {% endfor %}
                                </select>
                            </td>

                            <td style="width: 8%;border: red solid 0.5px;text-align: right;height: 35px;line-height: 35px;">公文类型：</td>
                            <td style="width: 30%;border: red solid 0.5px;padding-left: 0.5%;">
                                <select name="" id="official_type" style="width: 98%;border: 0;">
                                    <option value="决议">决议</option>
                                    <option value="决定">决定</option>
                                    <option value="命令">命令</option>
                                    <option value="公报">公报</option>
                                    <option value="公告">公告</option>
                                    <option value="通告">通告</option>
                                    <option value="意见">意见</option>
                                    <option value="通知">通知</option>
                                    <option value="通报">通报</option>
                                    <option value="报告">报告</option>
                                    <option value="请示">请示</option>
                                    <option value="批复">批复</option>
                                    <option value="议案">议案</option>
                                    <option value="函">函</option>
                                    <option value="纪要">纪要</option>
                                    <option value="公示">公示</option>
                                </select>
                            </td>
                        </tr>

                        <tr style="margin-left: 1%;">
                            <td style="width: 8%;border: red solid 0.5px;text-align: right;height: 35px;line-height: 35px;">编号类别：</td>
                            <td style="width: 30%;border: red solid 0.5px;padding-left: 0.5%;">
                                <select name="" id="number_type" style="width: 98%;border: 0;" onchange="get_option()">
                                    {% for number_type in number_type_list %}
                                        <option value="{{ number_type }}">{{ number_type }}</option>
                                    {% endfor %}
                                </select>
                            </td>
                            <td style="width: 8%;border: red solid 0.5px;text-align: right;height: 35px;line-height: 35px;">发文字号：</td>
                            <td id="dispatch-size" style="width: 30%;border: red solid 0.5px;padding-left: 1%;">{{ serial_definition }}</td>
                        </tr>

                        <tr style="margin-left: 1%;">
                            <td style="width: 8%;border: red solid 0.5px;text-align: right;height: 35px;line-height: 35px;">密级程度：</td>
                            <td style="width: 30%;border: red solid 0.5px;padding-left: 1%;">
                                <input type="radio" name="security" value="公开" checked> 公开
                                <input type="radio" style="margin-left: 3%;" name="security" value="秘密"> 秘密
                                <input type="radio" style="margin-left: 3%;" name="security" value="机密"> 机密
                            </td>

                            <td style="width: 8%;border: red solid 0.5px;text-align: right;height: 35px;line-height: 35px;">紧急程度：</td>
                            <td style="width: 30%;border: red solid 0.5px;padding-left: 1%;">
                                <input type="radio" name="exigency" value="普通" checked> 普通
                                <input type="radio" style="margin-left: 3%;" name="exigency" value="紧急"> 紧急
                                <input type="radio" style="margin-left: 3%;" name="exigency" value="加急"> 加急
                            </td>
                        </tr>

                        <tr style="margin-left: 1%;">
                            <td style="width: 8%;border: red solid 0.5px;text-align: right;height: 35px;line-height: 35px;">标题：</td>
                            <td id="title" style="width: 30%;border: red solid 0.5px;padding-left: 1%;line-height: 35px;" contenteditable="true"></td>

                            <td style="width: 8%;border: red solid 0.5px;text-align: right;height: 35px;line-height: 35px;">主题词：</td>
                            <td id="subject_term" style="width: 30%;border: red solid 0.5px;padding-left: 1%;line-height: 35px;" contenteditable="true"></td>
                        </tr>
                    </table>

                    <table style="width: 100%;">
                        <tr style="margin-left: 1%;">
                            <td style="width: 8%;border-right: red solid 0.5px;border-left: red solid 0.5px;border-bottom: red solid 0.5px;height: 35px;line-height: 35px;text-align: right;">主送单位：</td>
                            <td id="lord_send_unit" style="width: 68%;border-right: red solid 0.5px;border-left: red solid 0.5px;border-bottom: red solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;" contenteditable="true"></td>
                        </tr>
                        <tr style="margin-left: 1%;">
                            <td style="width: 8%;border-right: red solid 0.5px;border-left: red solid 0.5px;border-bottom: red solid 0.5px;height: 35px;line-height: 35px;text-align: right;">抄送单位：</td>
                            <td id="cc_unit" style="width: 68%;border-right: red solid 0.5px;border-left: red solid 0.5px;border-bottom: red solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;" contenteditable="true"></td>
                        </tr>
                    </table>

                    <table style="width: 100%;">
                        <tr style="margin-left: 1%;">
                            <td style="width: 8%;border-left: red solid 0.5px;border-bottom: red solid 0.5px;height: 35px;line-height: 35px;text-align: right;">拟稿人：</td>
                            <td id="drafter" style="width: 30%;height: 35px;line-height: 35px;padding-left: 1%;border-right: red solid 0.5px;border-left: red solid 0.5px;border-bottom: red solid 0.5px;">{{ realname }}</td>

                            <td style="width: 8%;border-right: red solid 0.5px;border-left: red solid 0.5px;border-bottom: red solid 0.5px;text-align: right;height: 35px;line-height: 35px;">拟稿部门：</td>
                            <td id="is_department" style="width: 30%;border-right: red solid 0.5px;border-left: red solid 0.5px;border-bottom: red solid 0.5px;padding-left: 1%;line-height: 35px;">{{ department }}</td>
                        </tr>

                        <tr style="margin-left: 1%;">
                            <td style="width: 8%;border: red solid 0.5px;height: 35px;line-height: 35px;text-align: right;">拟稿日期：</td>
                            <td id="is_the_date" style="width: 30%;height: 35px;line-height: 35px;padding-left: 1%;border: red solid 0.5px;">{{ draft_date }}</td>

                            <td style="width: 8%;border: red solid 0.5px;text-align: right;height: 35px;line-height: 35px;background: #F5F5F5;"></td>
                            <td style="width: 30%;border: red solid 0.5px;padding-left: 2%;background: #F5F5F5;"></td>
                        </tr>
                    </table>

                    <table style="width: 100%;">
                        <tr style="margin-left: 1%;">
                            <td style="width: 8%;border-right: red solid 0.5px;border-left: red solid 0.5px;border-bottom: red solid 0.5px;height: 35px;line-height: 35px;text-align: right;">核稿：</td>
                            <td style="width: 68%;border-right: red solid 0.5px;border-left: red solid 0.5px;border-bottom: red solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;background: #F5F5F5;"></td>
                        </tr>
                        <tr style="margin-left: 1%;">
                            <td style="width: 8%;border-right: red solid 0.5px;border-left: red solid 0.5px;border-bottom: red solid 0.5px;height: 35px;line-height: 35px;text-align: right;">会签：</td>
                            <td style="width: 68%;border-right: red solid 0.5px;border-left: red solid 0.5px;border-bottom: red solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;background: #F5F5F5;"></td>
                        </tr>
                        <tr style="margin-left: 1%;">
                            <td style="width: 8%;border-right: red solid 0.5px;border-left: red solid 0.5px;border-bottom: red solid 0.5px;height: 35px;line-height: 35px;text-align: right;">签发：</td>
                            <td style="width: 68%;border-right: red solid 0.5px;border-left: red solid 0.5px;border-bottom: red solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;background: #F5F5F5;"></td>
                        </tr>
                        <tr style="margin-left: 1%;display: none;">
                            <td style="width: 8%;border-right: red solid 0.5px;border-left: red solid 0.5px;border-bottom: red solid 0.5px;height: 35px;line-height: 35px;text-align: right;">公文分发：</td>
                            <td style="width: 68%;border-right: red solid 0.5px;border-left: red solid 0.5px;border-bottom: red solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;background: #F5F5F5;" data-toggle="modal" data-target=".bd-example-modal-xl" onclick="entrust()"></td>
                        </tr>

                        <tr style="margin-left: 1%;">
                            <td style="width: 8%;border-right: red solid 0.5px;border-left: red solid 0.5px;border-bottom: red solid 0.5px;height: 35px;line-height: 35px;text-align: right;">正文：</td>
                            <td style="width: 68%;border-right: red solid 0.5px;border-left: red solid 0.5px;border-bottom: red solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;">
                                <div>
                                    <a href="javascript:;" class="file" style="vertical-align:middle;">
                                        上传正文
                                        <input type="file" name="main_body" id="main_body" onchange="upload_accessory(this.id)">
                                    </a>
                                </div>
                                <div id="attachment_list" style="font-size: 0;margin: 0;padding: 0;">
                                    <ul style="width: 100%;padding: 0;">
                                        <li style="list-style: none;width: 100%;font-size: 14px;padding: 0;"><a id="main_body_a" href="#"></a></li>
                                    </ul>
                                </div>
                            </td>
                        </tr>

                        <tr style="margin-left: 1%;">
                            <td style="width: 8%;border-right: red solid 0.5px;border-left: red solid 0.5px;border-bottom: red solid 0.5px;height: 35px;line-height: 35px;text-align: right;">附件：</td>
                            <td style="width: 68%;border-right: red solid 0.5px;border-left: red solid 0.5px;border-bottom: red solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;">
                                <div>
                                    <a href="javascript:;" class="file" style="vertical-align:middle;">
                                        上传附件
                                        <input type="file" name="accessory" id="accessory" onchange="upload_accessory(this.id)">
                                    </a>
                                </div>
                                <div id="attachment_list" style="font-size: 0;margin: 0;padding: 0;">
                                    <ul style="width: 100%;padding: 0;">
                                        <li id="accessory_a" style="list-style: none;width: 100%;font-size: 14px;padding: 0;">

                                        </li>
                                    </ul>
                                </div>
                            </td>
                        </tr>
                    </table>

                </div>

                <div style="height: 30px;"></div>
            </div>

            <div style="width: 99%;background: white;margin-top: 1%;padding: 1%;color: #0b0b0b;">
                <div style="width: 100%;height: 50px;text-align: center;">
                    <h4 style="color: red;">任务节点设置</h4>
                </div>

                <table style="width: 100%;">
                    <tr style="margin-left: 1%;">
                        <td style="width: 8%;border: red solid 0.5px;height: 35px;line-height: 35px;text-align: right;">当前节点：</td>
                        <td style="width: 68%;border: red solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;">发文拟稿</td>
                    </tr>
                    <tr style="margin-left: 1%;">
                        <td style="width: 8%;border: red solid 0.5px;height: 35px;line-height: 35px;text-align: right;">待设定节点：</td>
                        <td style="width: 68%;border: red solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;">发文核稿</td>
                    </tr>
                    <tr style="margin-left: 1%;">
                        <td style="width: 8%;border: red solid 0.5px;height: 35px;line-height: 35px;text-align: right;">任务执行人：</td>
                        <td style="width: 68%;border: red solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;color: #1E90FF;" data-toggle="modal" data-target=".bd-example-modal-xl" onclick="entrust()"><span style="cursor: pointer;">选择</span><span id="executor" style="margin-left: 2%;"></span></td>
                    </tr>
                    <tr style="margin-left: 1%;">
                        <td style="width: 8%;border: red solid 0.5px;height: 35px;line-height: 35px;text-align: right;">待设定节点：</td>
                        <td style="width: 68%;border: red solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;">发文会签</td>
                    </tr>
                    <tr style="margin-left: 1%;">
                        <td style="width: 8%;border: red solid 0.5px;height: 35px;line-height: 35px;text-align: right;">任务执行人：</td>
                        <td style="width: 68%;border: red solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;color: #1E90FF;" data-toggle="modal" data-target=".bd-example-modal-xl" onclick="entrust1()"><span style="cursor: pointer;">选择</span><span id="executor1" style="margin-left: 2%;"></span></td>
                    </tr>
                    <tr style="margin-left: 1%;">
                        <td style="width: 8%;border: red solid 0.5px;height: 35px;line-height: 35px;text-align: right;">待设定节点：</td>
                        <td style="width: 68%;border: red solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;">发文签发</td>
                    </tr>
                    <tr style="margin-left: 1%;">
                        <td style="width: 8%;border: red solid 0.5px;height: 35px;line-height: 35px;text-align: right;">任务执行人：</td>
                        <td style="width: 68%;border: red solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;color: #1E90FF;" data-toggle="modal" data-target=".bd-example-modal-xl" onclick="entrust2()"><span style="cursor: pointer;">选择</span><span id="executor2" style="margin-left: 2%;"></span></td>
                    </tr>
                    <tr style="margin-left: 1%;">
                        <td style="width: 8%;border: red solid 0.5px;height: 35px;line-height: 35px;text-align: right;">待设定节点：</td>
                        <td style="width: 68%;border: red solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;">套红分发</td>
                    </tr>
                    <tr style="margin-left: 1%;">
                        <td style="width: 8%;border: red solid 0.5px;height: 35px;line-height: 35px;text-align: right;">任务执行人：</td>
                        <td style="width: 68%;border: red solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;color: #1E90FF;" data-toggle="modal" data-target=".bd-example-modal-xl" onclick="entrust3()"><span style="cursor: pointer;">选择</span><span id="executor3" style="margin-left: 2%;"></span></td>
                    </tr>
                </table>
            </div>
        </div>

        <!-- 流程图 -->
        <div style="width: 17%;margin-left: 1%;display: inline-block;vertical-align: top;margin-top: 1%;background: white;padding: 2%;">
            <div style="width: 100%;text-align: center;"><button style="border: #cfcfcf solid 0.5px;border-radius: 7px;width: 50%;height: 40px;color: green;"><i class="iconfont icon-kaishi"></i>开始</button></div>
            <div style="width: 100%;text-align: center;font-size: 28px;">&#8595;</div>
            <div style="width: 100%;text-align: center;"><button style="border: #cfcfcf solid 0.5px;border-radius: 7px;width: 70%;height: 40px;color: #00d0ff">发文拟稿</button></div>
            <div style="width: 100%;text-align: center;font-size: 28px;">&#8595;</div>
            <div style="width: 100%;text-align: center;"><button style="border: #cfcfcf solid 0.5px;border-radius: 7px;width: 70%;height: 40px;">发文核稿</button></div>
            <div style="width: 100%;text-align: center;font-size: 28px;">&#8595;</div>
            <div style="width: 100%;text-align: center;"><button style="border: #cfcfcf solid 0.5px;border-radius: 7px;width: 70%;height: 40px;">发文会签</button></div>
            <div style="width: 100%;text-align: center;font-size: 28px;">&#8595;</div>
            <div style="width: 100%;text-align: center;"><button style="border: #cfcfcf solid 0.5px;border-radius: 7px;width: 70%;height: 40px;">发文签发</button></div>
            <div style="width: 100%;text-align: center;font-size: 28px;">&#8595;</div>
            <div style="width: 100%;text-align: center;"><button style="border: #cfcfcf solid 0.5px;border-radius: 7px;width: 70%;height: 40px;">套红分发</button></div>
            <div style="width: 100%;text-align: center;font-size: 28px;">&#8595;</div>
            <div style="width: 100%;text-align: center;"><button style="border: #cfcfcf solid 0.5px;border-radius: 7px;width: 50%;height: 40px;color: green;"><i class="iconfont icon-jieshu"></i>结束</button></div>
        </div>


        <div class="modal fade bd-example-modal-xl" tabindex="-1" role="dialog"   aria-hidden="true">
        <div class="modal-dialog modal-xl" style="margin-top: 3%;">
            <div class="modal-content"  style="height: 600px;border-radius: 7px;width: 900px;margin-left: 15%;background: #F8F8FF;">
                <div class="modal-header" style="height: 50px;">
                    <h5 class="modal-title" style="line-height: 50px;width: 10%;">选择执行人</h5>
                    <button id="close-model" type="button" class="close" data-dismiss="modal" aria-label="Close"  style="margin-right: 3%;line-height: 50px;">
                        <span aria-hidden="true" style="font-size: 28px;">&times;</span>
                    </button>
                </div>
                <div class="modal-body" style="height: 200px;padding: 1%;">
                    <div style="display: inline-block;width: 30%;height: 70%;border-right: #E8E8E8 solid 1px;">
                        <div style="width: 100%;height: 35px;line-height: 35px;background: #98A6AD;padding-left: 2%;color: #0b0b0b">
                            选择部门
                        </div>
                        <div id="department_list" style="width: 100%;height: 95%;overflow: auto;">

                        </div>
                    </div>

                    <div style="display: inline-block;width: 69%;height: 70%;overflow: auto;vertical-align: top;left: 0;">
                        <table class="table table-hover table-bordered" style="border-collapse: collapse;">
                            <thead>
                                <tr>
                                    <th scope="col" style="width: 1%;">

                                    </th>
                                    <th scope="col" style="width: 2%;">序号</th>
                                    <th scope="col" style="width: 8%;">姓名</th>
                                </tr>
                            </thead>
                            <tbody style="overflow: auto;" id="t_table2"></tbody>
                        </table>
                        <div id="img-display1" style="width: 75%;text-align: center;">
                            <div style="margin-top: 10%;">
                                <img src="../../static/public_file/images/page-img/11.jpg" alt="">
                                <p style="margin: 0;padding: 0;vertical-align: top;">暂无数据</p>
                            </div>
                        </div>
                    </div>

                    <div style="height: 30%;width: 100%;border-top: #E8E8E8 solid 1px;overflow: auto;">
                        <div id="checked-label" style="margin-top: 1%;margin-left: 3%;">

                        </div>
                    </div>

                </div>
                <div class="modal-footer" style="height: 50px;">
                    <button id="model-affirm" type="button" class="btn btn-primary" style="margin-left: 2%;margin-right: 2%;" onclick="summit_val()">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;提&nbsp;交&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</button>
                </div>
            </div>
        </div>
    </div>
    </div>

    <button id="sour_del" style="display: none;" data-toggle="modal" data-target=".bd-example-modal-sm"></button>

    <!--确认删除？-->
    <div class="modal fade bd-example-modal-sm" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog modal-sm" style="margin-top: 10%;">
            <div class="modal-content" style="height: 150px;border-radius: 7px;width: 300px;background: #F8F8FF;border: #1E90FF solid 1px;">
                <div class="modal-header" style="height: 40px;background: #1E90FF;border-top-left-radius: 7px;border-top-right-radius: 7px;">
                    <h5 class="modal-title" style="line-height: 40px;width: 40%;text-align: center;color: #ffffff;">
                        提示对话框
                    </h5>
                    <button id="close-model2" type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-right: 3%;line-height: 40px;">
                        <span aria-hidden="true" style="font-size: 28px;color: white;">&times;</span>
                    </button>
                </div>
                <div class="modal-body" style="height: 50px;line-height: 60px;text-align: center;">
                    <p id="Confirm-content"></p>
                </div>
{#                <div class="modal-footer" style="height: 40px;">#}
{#                    <button id="countersign" type="button" class="btn btn-primary" aria-label="Close"#}
{#                            style="margin-left: 2%;margin-right: 2%;background: #1E90FF;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;确&nbsp;认&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#}
{#                    </button>#}
{#                </div>#}
            </div>
        </div>
    </div>
{% endblock %}


{% block script %}
    <script>
        function submit_val() {
            document.getElementById("loading").style.display = "inline-block";
            var postData = {};
            // 获取模版名称
            var obj = document.getElementById("model_name"); //定位id
            var index = obj.selectedIndex; // 选中索引
            postData["model_name"] = obj.options[index].text;                    // 模版名称

            // 获取公文类型
            var official_type_id = document.getElementById("official_type");
            var official_type_index = official_type_id.selectedIndex; // 选中索引
            postData["official_type"] = official_type_id.options[official_type_index].text;                    // 公文类型

            // 获取编号类别
            var number_type_id = document.getElementById("number_type");
            var number_type_index = number_type_id.selectedIndex; // 选中索引
            postData["number_type"] = number_type_id.options[number_type_index].text;                    // 公文类型

            // 获取发文字号
            postData["dispatch_size"] = document.getElementById("dispatch-size").innerText;

            // 获取密级程度
            postData["accuracy_class"] = $("input[type=radio][name=security]:checked").val();

            // 获取紧急程度
            postData["urgency_degree"] = $("input[type=radio][name=exigency]:checked").val();

            // 获取标题
            postData["title"] = document.getElementById("title").innerText;

            // 获取主题词
            postData["subject_term"] = document.getElementById("subject_term").innerText;

            // 获取主动单位
            postData["lord_send_unit"] = document.getElementById("lord_send_unit").innerText;

            // 获取抄送单位
            postData["cc_unit"] = document.getElementById("cc_unit").innerText;

            // 获取拟稿人
            postData["drafter"] = document.getElementById("drafter").innerText;

            // 获取拟稿部门
            postData["is_department"] = document.getElementById("is_department").innerText;

            // 获取拟稿日期
            postData["is_the_date"] = document.getElementById("is_the_date").innerText;

            // 获取当前节点、下一节点
            postData["at_present"] = "发文核稿";
            postData["next_present"] = "发文会签";

            // 获取正文链接
            postData["main_body_href"] = document.getElementById("main_body_a").getAttribute("href");

            // 获取附件链接
            var accessory_list = new Array();
            var li_list = document.getElementById("accessory_a").getElementsByTagName("a");
            for (var i=0; i<li_list.length; i++) {
                accessory_list.push(li_list[i].getAttribute("href"));
            }
            postData["accessory_list"] = accessory_list;

            // 获取执行方式
            postData["run_mode"] = "";

            // 获取执行人
            postData["operator"] = document.getElementById("executor").innerText;

            if (!postData["subject_term"]){
                document.getElementById("loading").style.display = "none";
                document.getElementById("Confirm-content").innerText = "请输入公文标题1！";
                document.getElementById("sour_del").click();
                return false
            }

            if (postData["main_body_href"] === "#") {
                document.getElementById("loading").style.display = "none";
                document.getElementById("Confirm-content").innerText = "请上传公文正文！";
                document.getElementById("sour_del").click();
                return false
            }

            if (!postData["operator"]){
                document.getElementById("loading").style.display = "none";
                document.getElementById("Confirm-content").innerText = "请选择任务执行人！";
                document.getElementById("sour_del").click();
                return false
            }

            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/document.html", true);
            xhr.send(JSON.stringify(postData));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        var JsonDate = JSON.parse(xhr.responseText);
                        window.location = "/administrative/document.html";
                        document.getElementById("loading").style.display = "none";
                    }
                }
            };
        }

        // 上传附件
        function upload_accessory(upload_type) {
            var form = new FormData();
            var files = document.getElementById(upload_type).files[0];
            form.append("file", files);
            form.append("upload_type", upload_type);
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/upload_accessory", true);
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (upload_type === "main_body"){
                            document.getElementById(upload_type+"_a").innerText = JsonDate["data"][0]["name"];
                            document.getElementById(upload_type+"_a").setAttribute("href", JsonDate["data"][0]["file_path"]);
                        }else {
                            var li_tag = document.getElementById(upload_type+"_a");
                            var p_tag = document.createElement("p");
                            var a_tag = document.createElement("a");
                            a_tag.innerText = JsonDate["data"][0]["name"];a_tag.setAttribute("href", JsonDate["data"][0]["file_path"]);
                            p_tag.appendChild(a_tag);li_tag.appendChild(p_tag);
                        }
                    }
                }
            };
        }
        function click_ul_9() {
            if (document.getElementById("jiantou5").className === "iconfont icon-jiantou-shang"){
                document.getElementById("jiantou5").className = "iconfont icon-jiantou-xia";
                document.getElementById("dispatch-Administrator-1").style.display = "inline-block";
            }else {
                document.getElementById("jiantou5").className = "iconfont icon-jiantou-shang";
                document.getElementById("dispatch-Administrator-1").style.display = "none";
            }
        }

        function click_ul_10() {
            if (document.getElementById("jiantou4").className === "iconfont icon-jiantou-shang"){
                document.getElementById("jiantou4").className = "iconfont icon-jiantou-xia";
                document.getElementById("dispatch-Administrator").style.display = "inline-block";
            }else {
                document.getElementById("jiantou4").className = "iconfont icon-jiantou-shang";
                document.getElementById("dispatch-Administrator").style.display = "none";
            }
        }
    </script>
{% endblock %}
